<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>阶乘计算</title>
</head>
<body>
    <script>
        var num = prompt("请输入一个数字");
        var result = 1;

        for( var i=1; i<=num; i++){
            result = result*i; 
        }
        alert(result);



        // 杨辉三角
        // var n = 10;
        // for(var i=1; i<=10; i++){


        //     document.write("<br>");

        //     for(var j=1; j<=i-1; j++){
        //         document.write((i-1)+","+j+",")
        //     }
        // }
        
    </script>
</body>
</html>